package com.x.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * ClassName: StudentDao
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.09.05 21:24
 */

@Repository
public class StudentDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void updateNameById(String name, int id){
        String sql = "update students set name = ? where id = ? ";
        int rows = jdbcTemplate.update(sql, name, id);

    }

    public void updateAgeById(int age, int id){
        String sql = "update students set age = ? where id = ? ";
        int rows = jdbcTemplate.update(sql, age, id);
    }
}
